namespace suishu
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }
        int min = 0;
        int max = 0;
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            if(textBox1.Text != null)
            {
                max = int.Parse(textBox1.Text);
            }
        }

        private void label3_Click(object sender, EventArgs e)
        {
            
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            if (textBox2.Text != null)
            {
                min = int.Parse(textBox2.Text);
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Button button = sender as Button;
            this.label3.Text = "";
            int suShuNum = 0;
            for(int i = min; i <=max; i++)
            {   
                if (i == 2) { this.label3.Text += "2"; suShuNum++; }
                else if (i == 3) { this.label3.Text += "      3"; suShuNum++; }
                else if (i == 5) { this.label3.Text += "      5"; suShuNum++; }
                else if (i == 7) { this.label3.Text += "      7"; suShuNum++; }
                else if (i == 1||i % 2 == 0 || i % 3 == 0 ||i%5 == 0 || i % 7 == 0) continue;
                else
                {
                    bool isSuShu = true;
                    for (int j = 11; j < (i-1/2); j++)
                    {
                        if (i % j == 0) isSuShu = false;
                    }
                    if (isSuShu)
                    {
                        suShuNum++;
                        this.label3.Text = this.label3.Text + "     " + i.ToString();
                        if (suShuNum % 10 == 0) this.label3.Text += "\n";
                    }
                }
            }
        }
    }
}